<?php 
class Controller_News_Tag extends ypController {
	public function Index() {
		$tag = htmlspecialchars(trim((string) $this->Request->GET('tag')));
		
		$posts = array();
		if ($tag) {
			$this->Loader->model('News/Tag');
			$posts = $this->Model_News_Tag->loadPost($tag);
		}
		
		$this->loadLanguage('News/Tag');
		$this->set('head_title', sprintf($this->_data['text_all_post_with_tag'], $tag));
		$this->set('posts', $posts);
		
		$this->setTemplate('module/News/Listpost.php');
		$this->setTemplateChild(array(
			'System/Header',
			'System/Footer',
		));
		$this->Response->setOutput($this->render());
	}
}